{% extends 'base.html' %}

{% block content %}
<title>
    主页 - 畅聊
</title>

<script>
	function delete_member(group_id){
		if (confirm('是否删除')){
			location.href='/delete_member/'+group_id;
		}
	}
	
	function search(){
		location.href='/search_group';
	}

</script>

<h1>欢迎使用畅聊</h1>
<br/>
<img src="/static/search_icon.png" onclick="search()"
     style="cursor:pointer;position:absolute;right:30px;width:25px;height:25px;border: 2px solid #008CBA;border-radius: 5px;"/>
<br/>
<hr/>
{% for group in chatgroups %}
<a href="{% url 'chat:chatgroup' group.id %}">
    <h2>
        <img src="{% url 'chat:index' %}static/group_icon.png"
             style="height:30px;width:30px;position:relative;top:9px"/><span style="position:relative;left:10px">{{group.name}}</span>
    </h2></a><span style="font-size:15px;color:grey;">&nbsp&nbspid:{{group.id}}</span>
<button onclick=delete_member({{group.id}}) style="position:absolute;right:15px;">删除</button>
<pre style="font-size:15px;"> {{group.introduce}}</pre>
<br/>
<hr/>
{% endfor %}
<a href="{% url 'chat:create_group' %}">新建</a>

{% endblock content %}
